/* File : errcode.h */

#ifndef __ERR_CODE_H__
#define __ERR_CODE_H__

typedef enum enInnerErrCode{
    ERR_COMMON_SUCCEED          = 0, /* succeed return */

    /* 1~19 for basic error */
    ERR_COMMON_FAIL                 = 1, /* common fail */
    ERR_INPUT_PARAM_NUM          = 2, /* invalid input parameters number */
    ERR_INPUT_PARAM_INFO         = 3, /* invalid input parameters */
    ERR_INIT_LOG_MRG                 = 4, /* failed to init log management */

    /* 20~49 for network error */
    ERR_GET_ADDR_INFO               = 20, /* failed to get ip address info */
    ERR_CREAT_SOCK                    = 21, /* failed to creat socket */
    ERR_CONNECT_REMOTE            = 22, /* failed to connect remote host */
    ERR_BIND_SOCK                      = 23, /* failed to bind socket */
    ERR_LISTEN_SOCK                   = 24, /* failed to listen socket */
    ERR_SEND_MSG                       = 25, /* failed to send message */
    ERR_RECV_MSG                       = 26, /* failed to receive message */
    ERR_SELECT_FAIL                    = 27, /* failed to select */
    ERR_SELECT_TIMEOUT              = 28, /* select timeout */
    ERR_GET_LOCAL_DOMAIN         = 29, /* failed to get local domain name */
    ERR_GET_LOCAL_ADDR             = 30, /* failed to get local ip address */
    ERR_GET_LOCAL_MAC               = 31, /* failed to get local MAC address */
    ERR_GET_SOCK_NAME               = 32, /* failed to get socket name info */
    ERR_GEN_HMAC                        = 33, /* failed to generate HMAC key */
    ERR_PEER_OPERATE_RESULT      = 34, /* peer host return fail result */

    /* 50~69 for file error */
    ERR_OPEN_FILE                        = 50, /* failed to open file */
    ERR_WRITE_FILE                       = 51, /* failed to write to file */
    ERR_READ_FILE                         = 52, /* failed to read from file */
    ERR_NOT_EXIST_ITEM                = 53, /* the item not exist in file */
    ERR_INVALID_ITEM_VALUE         = 54, /* invalid item value */

    /* 70~99 for sys interface error */
    ERR_SIGACTION_FAIL                 = 70, /* failed to register sigaction */
    ERR_PROGRAM_TERM                  = 71, /* the program is termed */
    ERR_PROGRAM_ABRT                  = 72, /* the program is abort */

    /* 100~125 for DB error */
    ERR_CONNECT_DB                      = 100, /* failed to connect db */
    ERR_VISIT_DB                            = 101, /* failed to visit db */
    ERR_NOT_EXIST_RECORD            = 102, /* the record not exist */
    ERR_GET_VALUE_FROM_DB         = 103, /* failed to get value from db */

    /* 126/127 for system call common fail */
    ERR_SYS_COMMON_FAIL1             = 126, /* the system function call common return */
    ERR_SYS_COMMON_FAIL2             = 127, /* the system function call common return, for char type is -1 */

    /* 130 ~3999 Execute monitor */
    ERR_EXE_MONITOR_PROGRAM          = 130, /* failed to execute monitor program */
    ERR_EXE_MONITOR_TIMEOUT           = 131, /* the monitor program execute timeout */
    ERR_CREAT_WAIT_THREAD               = 132, /* failed to creat wait monitor execute result thread */

    /* 4000 ~4099 for autoinstall */
    ERR_GET_PLUGIN_LIST                         = 4000, /* failed to execute cmd get plugin list */
    ERR_QUERY_RPM_PACKAGE_INFO      = 4001, /* failed to query rpm package info */
    ERR_RPM_PACKAGE_RELOCATION      = 4002, /* rpm relocation path err */
    ERR_NOT_EXIST_FILE                        = 4003, /* not exist file */
    ERR_MV_FILE                                    = 4004, /* failed to move files */

    /* 4100 ~4499 for killer monitor */
    ERR_INIT_EXOSIP                        = 4100, /* failed to init exosip */
    ERR_CREAT_INVITE                      = 4101, /* failed to creat invite message */
    ERR_INVALID_IP_ADDR                 = 4102, /* invalid ip address */
    ERR_RTP_ERROR                          = 4103, /* rtp error */
    ERR_SESSION_EXIST                     = 4104, /* session already exist */
    ERR_RTP_SESSION_NOT_CREAT     = 4105, /* session not creat */
    ERR_RTP_SESSION_NOT_ACTIVE     = 4106 /* session not active */

    /* 4500 ~others */

}INNER_ERROR_CODE_E;

typedef enum enExterErrCode{
    ERR_EXTER_SUCCEED          = 0, /* succeed return */

    ERR_EXTER_WARN               = 1, /* warning, DB Status 3001 */
    ERR_EXTER_ERROR              = 2, /* common error, DB Status 3002 */
    ERR_EXTER_CRIT                 = 3, /* Critical level error, DB Status 3003 */
    ERR_EXTER_TIMEOUT           = 4  /* Timeout error, DB Status 13004 */

}EXTER_ERROR_CODE_E;

#endif /* __ERR_CODE_H__ */
